Subroutine Editor

The Subroutines edit table consists of several fields which identify the components of a subroutine. Each of these fields is described below.

 

ID A name that identifies the subroutine.

Type The type of numeric value returned by the subroutine can be Real, Integer, None, or Interactive. Use Real and Integer if the subroutine returns a number and None when no return value is expected, as is often the case in initialization or termination logic. Subroutines of type Interactive are identical to subroutines of type None, except that interactive subroutines are also accessible for activation by the user through the run-time menu. Interactive subroutines are displayed in the Interact menu during runtime. For more information on Interactive subroutines, see the discussion later in this section.

Parameters Arguments passed to the subroutine get assigned to local variables called parameters. Items passed to a subroutine as arguments can have different names than the parameters that receive them. Parameters can be real or integer. The first parameter receives the first argument, the second parameter receives the second argument, and so on.

Logic One or more statements to be executed whenever the subroutine is called. Statements in subroutines must be valid in the logic that calls the subroutine. Subroutine logic may contain a RETURN statement with a value to be returned from the subroutine. See Return for the correct syntax and an example of this statement.

Please note

Subroutine editor notes:

1. If the subroutine is of type Integer and the return value is a real number, the return value will be truncated unless the ROUND() function is used (e.g., RETURN ROUND(<numeric expression>)).

2. If you do not want a stand-alone subroutine referenced in operation logic to be treated as an implicit wait statement, define the subroutine as type None.

3. When using the ACTIVATE statement to call a subroutine, the calling logic continues without waiting for the called subroutine to finish. Therefore, independent subroutines can run in parallel with the logic that called them.

4. Independent subroutines called with the ACTIVATE statement cannot contain entity-specific or location-specific system functions.